<?php

namespace App\Sys\Providers;


use App\Providers\EventServiceProvider;
use App\Sys\Facades\DictProvinceFacade;
use App\Sys\Facades\SysAppFacade;
use App\Sys\Facades\SysLogFacade;
use App\Sys\Facades\SysMenuFuncAuthFacade;
use App\Sys\Facades\SysRoleFacade;
use App\Sys\Models\DictProvinceModel;
use App\Sys\Models\SysAppModel;
use App\Sys\Models\SysLogModel;
use App\Sys\Models\SysMenuFuncAuthModel;
use App\Sys\Models\SysRoleModel;
use App\Sys\Services\DictProvinceService;
use App\Sys\Services\SysAppService;
use App\Sys\Services\SysLogService;
use App\Sys\Services\SysMenuFuncAuthService;
use App\Sys\Services\SysRoleService;
use App\User\Facades\UserBindAppFacade;
use App\User\Models\UserBindAppModel;
use App\User\Services\UserBindAppService;

//EloquentUserProvider
class SysProvider extends EventServiceProvider
{

    /**
     * 注册绑定门面
     */
    public function register()
    {

        //用户授权
        $this->app->bind(SysMenuFuncAuthService::class, function () {
            return new SysMenuFuncAuthService(new SysMenuFuncAuthModel());
        });
        $this->app->bind(SysMenuFuncAuthFacade::class, function () {
            return app()->make(SysMenuFuncAuthService::class);
        });

        //用户角色
        $this->app->bind(SysRoleService::class, function () {
            return new SysRoleService(new SysRoleModel());
        });
        $this->app->bind(SysRoleFacade::class, function () {
            return app()->make(SysRoleService::class);
        });

        //系统应用
        $this->app->bind(SysAppService::class, function () {
            return new SysAppService(new SysAppModel());
        });
        $this->app->bind(SysAppFacade::class, function () {
            return app()->make(SysAppService::class);
        });

        //用户角色/系统应用绑定
        $this->app->bind(UserBindAppService::class, function () {
            return new UserBindAppService(new UserBindAppModel());
        });
        $this->app->bind(UserBindAppFacade::class, function () {
            return app()->make(UserBindAppService::class);
        });

        //用户记录
        $this->app->bind(SysLogService::class, function () {
            return new SysLogService(new SysLogModel());
        });
        $this->app->bind(SysLogFacade::class, function () {
            return app()->make(SysLogService::class);
        });

        $this->app->bind(DictProvinceService::class, function () {
            return new DictProvinceService(new DictProvinceModel());
        });
        $this->app->bind(DictProvinceFacade::class, function () {
            return app()->make(DictProvinceService::class);
        });
    }
}
